From Types to Contracts: Supporting by Light-Weight Specifications the Liskov Substitution Principle∗
نویسنده
چکیده
In this paper we review the main theoretical elements of behavioral subtyping in object-oriented programming languages in a semi-formal style that should allow software developers to understand better in which situations the Liskov substitution principle (objects of subclasses may stand for objects of superclasses) is violated. We then shortly discuss the specification of class contracts in behavioral specification languages that allow to ensure that the substitution principle is preserved. Since many software developers may shy away form these languages because the learning curve is esteemed as too steep, we propose a language of light-weight specifications that provides by a hierarchy of gradually more expressive specification forms a more lenient path towards the use of behavioral specification languages. The specifications do not demand the use of predicate logic; by automatic checking certain violations of the substitution principle may be detected. ∗Supported by the Austrian Academic Exchange Service (ÖAD) under the contract HU 14/2009.
منابع مشابه
Contracts in the Wild: A Study of Java Programs
The use of formal contracts has long been advocated as an approach to develop programs that are provably correct. However, the reality is that adoption of contracts has been slow in practice. Despite this, the adoption of lightweight contracts — typically utilising runtime checking — has progressed. In the case of Java, built-in features of the language (e.g. assertions and exceptions) can be u...
متن کاملThe General Rules of Contracts and the Rules of Anti-avoidance and Anti-evasion Paying Taxes (Tax Fraud)
Taxation issues are among the factors which balance between private rights and public interests. But the legal system of contracts also works for the welfare of the people and society. The general rules of contracts and the principles of private law have found their essential functions during the years. Applying the above rules aimed at preserving public order along with the private rights of ...
متن کاملEthics Governing International Investment Contracts unless the Applicable Law is Established
Background: Settlement of disputes arising from foreign investment may be possible if the governing law is clear. Irrespective of international treaties, since the legal relationship between the investor and the investee is often included in investment contracts, the law governing such contracts is determined. But there are cases where the ruling law has not been determined. In this case, three...
متن کاملCombining Manifest Contracts with State
Manifest contracts combine the rich specifications and runtime checking of higher-order contracts [11] with a static type discipline. Conventional type systems prevent simple errors, like calling a boolean as a function, but manifest contracts can prevent more complex errors. For example, we could give the sqrt function the very precise type {x:Float | x ≥ 0} → {y:Float | |x − y| < }, where sub...
متن کاملتأملی درباره جایگاه اصل حاکمیت اراده در قرارداد واگذاری سهام دولت در فرایند خصوصی سازی
The principle of voluntarism has essential role in formation of contract, choice of contract party and ascertaining the terms of contract in the law of contract in Iran. However, the position of this principle as for contracts of assignment of government shares in the process of privatization, specifically with respect to the power and authority of contract parties to ascertain the terms of the...
متن کامل